package cc.ruih.meizanchen.dao;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DatabaseDAO extends SQLiteOpenHelper {

	public static final String DATABASE_NAME="mzc.db";	// 美赞臣项目数据库名
	public static final int DATABASE_VERSON=1;		// 数据库版本
	public static final String TABLE_GOODS="goods";		// 物品名称表
	
	//入院物品
	public static final String TABLEGOODS=
		"create table goods("+
		"_id INTEGER PRIMARY KEY,"+		//rowID
		"name TEXT  NOT NULL,"+ 	//物品名
		"isbuy INTEGER NOT NULL,"+ 	//是否购买
		"used INTEGER NOT NULL"+	// 物品被使用者
		"remind TEXT,"+ //提醒
		"typeName TEXT,"+ 	//物品种类
		"detail TEXT"+ 	//详情
		");";
	/*// 产检记录表
	public static final String TABLECHECK=
			"create table goods("+
			"_id INTEGER PRIMARY KEY,"+		//rowID
			"name TEXT  NOT NULL,"+ 	//物品名
			"isbuy INTEGER NOT NULL,"+ 	//联系人图标
			"remind TEXT,"+ //所属组名
			"typeName TEXT,"+ 	//详情
			"detail TEXT"+ 	//提醒时间
			");";
	// 踢踢记录表
	public static final String TABLERECORD=
			"create table goods("+
			"_id INTEGER PRIMARY KEY,"+		//rowID
			"name TEXT  NOT NULL,"+ 	//物品名
			"isbuy INTEGER NOT NULL,"+ 	//联系人图标
			"remind TEXT,"+ //所属组名
			"typeName TEXT,"+ 	//详情
			"detail TEXT"+ 	//提醒时间
			");";*/
	
	public DatabaseDAO(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSON);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(TABLEGOODS);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS "+TABLE_GOODS);
		onCreate(db);
	}
	
}
